#ifndef __FILTER_H
#define __FILTER_H

#include "stdint.h"
#include "arm_math.h"

#define ABS(x) (x >= 0 ? x : -x)

#define SLDMEAN_SIZE 10

typedef struct
{
    uint8_t i;
    float data[SLDMEAN_SIZE];
    float out;
    uint8_t init;
} sldMean_t;

typedef struct
{
    float P_last;
    float X_last;
    float Q;
    float R;

    float K;
    float X;
    float P;

    float Z;
} kalman_t;

void kalman_Init(void);
float KalmanFilter(kalman_t *K_Flt, float Z);
float sldMeanFilter(sldMean_t *M_Flt, float in);

#endif
